package cn.edu.sptc.sms_weiwubo.service.impl;


import cn.edu.sptc.sms_weiwubo.dao.MajorMapper;
import cn.edu.sptc.sms_weiwubo.entity.Major;
import cn.edu.sptc.sms_weiwubo.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MajorServiceImpl implements MajorService {
    //调用数据访问层dao
    @Autowired
    private MajorMapper majorMapper;
    @Override
    public boolean insertMajor(Major major) {
        if(majorMapper.insert(major) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateMajor(Major major) {
        if(majorMapper.update(major) > 0 ){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteMajor(Long id) {
        if(majorMapper.delete(id) > 0){
            return true;
        }
        return false;
    }

    @Override
    public List<Major> queryByAll() {
        return majorMapper.selelectAll();
    }

    @Override
    public Major queryByID(Long id) {
        return majorMapper.selectByID(id);
    }
}
